package cn.com.surker.lab.service.impl;

import cn.com.surker.enums.StateEnum;
import cn.com.surker.lab.entity.LabExpendBatch;
import cn.com.surker.lab.service.ErpLabExpendBatchService;
import cn.com.surker.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.springframework.stereotype.Service;

/**
 * @author luotao
 * @date 2024/11/5
 */
@Service
public class ErpLabExpendBatchImpl extends LabExpendBatchBaseImpl implements ErpLabExpendBatchService {

	@Override
	public void delByInv(Long invoiceId, String remark) {
		if (invoiceId == null) {
			return;
		}
		UpdateWrapper<LabExpendBatch> uw = new UpdateWrapper<>();
		uw.eq("invoice_id", invoiceId);
		if (StringUtils.isNotBlank(remark)) {
			uw.set("remark", "concat(remark,;" + remark + ")");
		}
		uw.set("status", StateEnum.DISABLED.getCode());
		int update = labExpendBatchDao.update(new LabExpendBatch(), uw);
	}
}
